#ifndef __LINUX_ERR_H__
#define __LINUX_ERR_H__

#include "linux/compiler.h"

#define MAX_ERRNO	4095

#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)

static inline void *  ERR_PTR(long error)
{
	return (void *) error;
}

static inline long  PTR_ERR(__force void *ptr)
{
	return (long) ptr;
}

static inline int  IS_ERR(__force void *ptr)
{
	return IS_ERR_VALUE((unsigned long)ptr);
}

static inline int  IS_ERR_OR_NULL(__force void *ptr)
{
	return (!ptr) || IS_ERR_VALUE((unsigned long)ptr);
}

#endif
